package cn.javass.dp.factorymethod.mydemo1;

import java.sql.Connection;

public class ConnectionDBFactory  {

    public  Connection getConnection(String type, String data) {
        AbstractConnection conn = factoryMethod(type);
        return conn.getConnection();
    }

    protected AbstractConnection factoryMethod(String type) {
        AbstractConnection conn = null;
        if ("01".equals(type)) {
            conn = new OracleConnectionAbstract();
        } else if ("02".equals(type)) {
            conn = new MysqlConnectionAbstract();
        }
        return conn;
    }
}
